package cn.com.dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

import cn.com.entity.GuanLiYuan;

public class GuanLiYuanDao {
	private SessionFactory sessionFactory;

	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	Session session;
	Transaction transaction;
	public boolean guanLiLogin(String uname,String upwd){
		boolean b=false;
		session=sessionFactory.openSession();
		String hql="from GuanLiYuan where uname=? and upwd=?";
		Query query=session.createQuery(hql);
		query.setString(0, uname);
		query.setString(1, upwd);
		List<GuanLiYuan> list=query.list();
		if(list.size()==1){
			b=true;
		}
		session.close();
		return b;
	}

}
